Use JSON.parse() to parse systemd log records, rather than using
regexps.
https://bugzilla.gnome.org/show_bug.cgi?id=732350
'MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5',
'UNIT=graphical.target',
'-o',
- 'json-pretty'],
+ 'json'],
Gio.SubprocessFlags.STDOUT_PIPE);
let result = null;
if (line === null)
break;
- let m = /.*"__MONOTONIC_TIMESTAMP".*"([0-9]+)"/.exec(line);
- if (m) {
- result = Number(m[1]);
- }
+ let fields = JSON.parse(line);
+ result = Number(fields['__MONOTONIC_TIMESTAMP']);
}
datastream.close(null);
return result;